import 'package:flutter/material.dart';
import 'package:flutterdemo01/demo56/xianyupage/XyHomePage.dart';
import 'package:flutterdemo01/demo56/xianyupage/XyMiddlePage.dart';
import 'package:flutterdemo01/demo56/xianyupage/XySetPage.dart';
import 'package:flutterdemo01/按钮练习.dart';
import 'package:flutterdemo01/日期控件.dart';
import 'package:flutterdemo01/轮播图.dart';
import 'package:flutterdemo01/弹窗dialog.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
main() {
  runApp(Xianyu());
}

class Xianyu extends StatefulWidget {
  const Xianyu({Key? key}) : super(key: key);

  @override
  _XianyuState createState() => _XianyuState();
}

class _XianyuState extends State<Xianyu> {

  int chooseIndex = 0;
  List pages = [
    XyHomePage(),
    XyMiddlePage(),
    XySetPage()
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(

      initialRoute: "/myDialogStudy",
      routes: {
        // "/" :(context) => XyHomePage(),
        '/button' :(context) => PracticeButton(),
        '/DateView' :(context) => DateView(),
        '/swiperDemo' :(context) => SwiperDemo(),
        '/myDialogStudy' :(context) => MyDialogStudy(),

      },
      home: Scaffold(
        appBar: AppBar(
          leading: IconButton(onPressed: () {}, icon: Icon(Icons.home),

          ),
          actions: [ //右侧按钮
            IconButton(onPressed: () {}, icon: Icon(Icons.map)),
            IconButton(onPressed: () {}, icon: Icon(Icons.sanitizer_outlined)),
            IconButton(onPressed: () {}, icon: Icon(Icons.tab_unselected)),
          ],

        ),
        floatingActionButton: Container(
          padding: EdgeInsets.all(5),
          decoration: BoxDecoration(
              color: Colors.white,
              shape: BoxShape.circle
          ),
          width: 65,
          height: 65,
          margin: EdgeInsets.only(top: 5),
          child:  FloatingActionButton(onPressed: () {},
              child: Icon(Icons.add ,size: 40,),
              backgroundColor: Colors.yellow,
              foregroundColor: Colors.red,

            )
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,

        bottomNavigationBar: BottomNavigationBar(

          backgroundColor: Colors.white,
          currentIndex: chooseIndex,
          onTap: (index) {
            setState(() {
              chooseIndex = index;
            });
          },
          items: [
            BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页',),
            BottomNavigationBarItem(icon: Icon(Icons.nat), label: '消息'),
            BottomNavigationBarItem(icon: Icon(Icons.settings), label: '设置'),
          ],
        ),
        body: pages[chooseIndex],
      ),
      localizationsDelegates: [
        //此处
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: [
        //此处
        const Locale('zh', 'CH'),
        const Locale('en', 'US'),
      ],
    );
  }
}

